package com.wsx.sky.dubbo.service;

import com.wsx.sky.http.bean.HttpRequest;
import com.wsx.sky.http.bean.HttpResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author wangshuaixin
 * @Title: com.wsx.sky.dubbo.service.HttpServerFeign
 * @Description: TODO
 * @date 2018/12/11
 */
@FeignClient(name = "http", url = "http://127.0.0.1:8132/http/server/")
public interface HttpServerFeign {

    @RequestMapping(
            value = "/request/feign",
            method = {RequestMethod.POST},
            consumes = {MediaType.APPLICATION_JSON_VALUE},
            produces = {MediaType.APPLICATION_JSON_VALUE}
    )
    HttpResponse feign(@RequestBody HttpRequest httpRequest);


    @RequestMapping(
            value = "/get/feign/{name}",
            method = {RequestMethod.GET},
            produces = {MediaType.APPLICATION_JSON_VALUE}
    )
    HttpResponse get(@PathVariable("name") String name);
}
